-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide feedback if it takes a while to download a remote component on spin up
#2226
Conversation
Signed-off-by: Archisman Mridha <archismanmridha12345@gmail.com>
spin up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Archisman-Mridha, welcome and thanks!
I'm afraid this PR doesn't answer the issue you mentioned (unless I've misread the link), and it's not quite the way we usually do these "taking a long time" warnings anyway. What you have here would always print a message whenever an application was pulled or run from an OCI registry reference. What #2109 is looking for is to print a message for a remote component, and to print it if it takes a while. Let me drill into those two phrases a bit:
-
By a "remote component", we mean a component referenced via a remote reference. Today, the only remote references for components are HTTP references such as the one in the
static-fileserver
template. The emphasis on component here is because such a component could be in a local application, even a freshly created one. (It's more surprising when a local app is slow to load than when a remote app is slow to load!) This is a different code path from pulling an entire from the registry to local - see e.g. https://github.com/fermyon/spin/blob/main/crates/loader/src/http.rs. -
By "if it takes a while", we mean we don't print "downloading / starting / whatever" every time the user does the thing. This risks the user tuning out the warning that they see all the time, so not registering it when it actually matters. Another example of this is if an app's Wasm modules are taking a long time to load. In this case we wait 1.25 seconds before displaying a "slow load" message (
spin/crates/trigger/src/cli.rs
Line 191 in 7a6b81b
let _sloth_guard = warn_if_wasm_build_slothful(); spin_common::sloth
module provides a function which manages this by running a background timer and printing only if the returned guard is still live when the timer expires.
I hope this is useful feedback - of course please let me know if the desired behaviour or the way to go about it is not clear. And thanks again for getting involved!
spin up
spin up
Oops. Thanks for the catch on the title @Archisman-Mridha...! embarrassed |
@itowlson Thanks for the quick and in-detail response! Sorry for misunderstanding the issue. I am working on it.... Steps I took to clear out my concepts
My current understanding
Components downloading is done by the Am I right ? |
Your understanding is right. Your proposal is almost right, but there is a small nuance: we might now want to place the sloth guard inside Why do it this way? Consider a manifest with a large number of remote components. (For example, So a more desirable plan is to find where all the remote components are being downloaded (e.g. in a loop or as a map of futures), which will be a place that directly or indirectly calls Does that help? Again, happy to discuss further or give you more specific pointers if that would be useful. |
@itowlson Thanks for being supportive! I figured it this is where all the components are loaded concurrently : // Load all components concurrently
let components = try_join_all(components.into_iter().map(|(id, c)| async move {
self.load_component(&id, c)
.await
.with_context(|| format!("Failed to load component `{id}`"))
}))
.await?; I need to put the
|
Yes, that looks right. Call |
Signed-off-by: Archisman Mridha <archismanmridha12345@gmail.com>
Good morning :). I pushed a commit. Please let me know if the changes look okay or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach looks good - thanks for persevering with this! However, there is an important detail about keeping the SlothGuard
alive (see comments). (This is on us - Rust has a way to warn about this kind of thing, and I forgot to set it up.) Other than that and a couple of nits it looks good to go though!
Signed-off-by: Archisman Mridha <archismanmridha12345@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! I will merge once CI completes (barring any hiccups). Thanks for your patience and perseverance.
Oh! Could you mark the PR ready for review please @Archisman-Mridha? It's still draft and can't be merged in that state. |
Done |
No description provided.